solving equations with two unknowns